﻿using Lockstep.Collision2D;
using Lockstep.Math;
using Sirenix.OdinInspector;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace Lockstep.Game
{
    /// <summary>
    /// 墙体类型
    /// </summary>
    public enum SceneObjType
    {
        None,
        EnemyBorn,
        PlayerBorn, //主玩家
        Home,
        Brick, //砖块（可以被打碎）
        Barrier,//堡垒障碍（无法被击碎）
        Water,//水流障碍（无法通过，只有子弹可以）
        Grass,//草地（降低移动速度）
        Border,//边界墙
        PlayerBorn2, //第二玩家
    }
    [Serializable]
    public partial class BorderInfo
    {

    }
    /// <summary>
    /// 怪物出生点信息
    /// </summary>
    [Serializable]
    public partial class EnmeyBornInfo
    {
        [LabelText("出生间隔")]
        public LFloat spawnTime = 5;
        [LabelText("怪物数量")]
        public int maxCount = 2;
        [LabelText("怪物配置id")]
        public int prefabId = 2;
    }
    [Serializable]
    public partial class PlayerBornInfo
    {
        [LabelText("复活次数")]
        public int reLifeCount = 1;
        [LabelText("角色配置id")]
        public int prefabId = 1;
        [LabelText("出生间隔")]
        public LFloat spawnTime = 3;
    }
    [Serializable]
    public partial class HomeInfo
    {
        [LabelText("击中次数")]
        public int hitCount = 1;
    }
    [Serializable]
    public partial class BrickInfo
    {
        [LabelText("击中次数")]
        public int hitCount = 1;
    }
    [Serializable]
    public partial class BarrierInfo
    {

    }
    [Serializable]
    public partial class GrassInfo
    {
        //降低的移动速度比例
        [LabelText("降低的移动速度比例")]
        public LFloat slowRate = new LFloat(true, 500);
    }
    [Serializable]
    public partial class WaterInfo
    {

    }

    [CreateAssetMenu(menuName = "ScriptableObject/WallCellConfig")]
    public partial class WallCellConfig : SerializedScriptableObject
    {
        [LabelText("物件类型")]
        public SceneObjType type;
        [ShowIf("type", SceneObjType.EnemyBorn), HideLabel]
        public EnmeyBornInfo enmeyBornInfo;
        [ShowIf("@type == SceneObjType.PlayerBorn || type == SceneObjType.PlayerBorn2"), HideLabel]
        public PlayerBornInfo playerBornInfo;
        [ShowIf("type", SceneObjType.Home), HideLabel]
        public HomeInfo homeInfo;
        [ShowIf("type", SceneObjType.Brick), HideLabel]
        public BrickInfo brickInfo;
        [ShowIf("type", SceneObjType.Barrier), HideLabel]
        public BarrierInfo barrierInfo;
        [ShowIf("type", SceneObjType.Water), HideLabel]
        public WaterInfo waterInfo;
        [ShowIf("type", SceneObjType.Grass), HideLabel]
        public GrassInfo grassInfo;
        [AssetsOnly, LabelText("物件预设")]
        public GameObject prefab;
        public bool isCollider;
        [LabelText("碰撞层"), ShowIf("isCollider")]
        public EColliderLayer colliderLayer = EColliderLayer.Static;
        [LabelText("碰撞数据"), ShowIf("isCollider")]
        public ColliderData colliderData;
    }
}
